<?php

/**
* Controller:  "Welcome"
*
* This controller loads the front page of the site, which allows visitors
* to select a pet to learn more about.
*
* Functions:  index
*
* @author     Brandon A Johnson
* @copyright  LIS4368-01: "Web Development with PHP," Spring 2010
* @version    1.0
* @date       April 24, 2010
*
*/

class Welcome extends Controller {
	
	/**
	* Welcome() - constructor
	*
	* allows this file to act as a valid CodeIgniter controller
	*/
	function Welcome()
	{
		parent::Controller();
	}

	/**
	* index()
	*
	* the website front page, that allows visitors to select a pet
	* to learn more about
	*/
	function index()
	{
		// destroys the cookie session just in case someone clicks here from the secure section
		$this->load->library('session');
		$this->session->sess_destroy();

		// loads the "pets" database interaction model
		$this->load->model('pets_model');
		// extracts all pet records currently in the table
		$all_pets = $this->pets_model->list_pets();
		// prepares the data to be sent to the view
		$data = array();
		$data['results'] = $all_pets;

		// loads the views
		$this->load->view('header');
		$this->load->view('home', $data);
	}
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */